package com.sina.microblog.data
{
	/**
	 * MicroBlogRateLimit是一个数据封装类(Value Object)，用于返回每小时还剩下的点击数
	 */ 
	public class MicroBlogRateLimit
	{
		public var ipLimit:int;
		public var limitTimeUnit:String;
		public var remainingIpHits:int;
		public var remainingUserHits:int;
		public var resetTime:Date;
		public var resetTimeInSeconds:int;
		public var userLimit:int;
		
		/**
		 * API每小时允许的请求数，POST类型的动作，例如发布微博、发布评论、发送私信...
		 */ 		
		public var apiRateLimits:Array;

		
		public function MicroBlogRateLimit(limit:Object)
		{
			this.ipLimit = limit["ip_limit"];
			this.limitTimeUnit = limit["limit_time_unit"];
			this.remainingIpHits = limit["remaining_ip_hits"];
			this.remainingUserHits = limit["remaining_user_hits"];
			this.resetTime = MicroBlogDataUtil.resolveDate(limit["reset_time"]);
			this.resetTimeInSeconds = limit["reset_time_in_seconds"];
			this.userLimit = limit["user_limit"];
			
			this.apiRateLimits = limit["api_rate_limits"];
			
		}
	}
}